package com.gome.axwl.aoc.service.impl;

import com.gome.axwl.aoc.dao.ApprovalRecordDao;
import com.gome.axwl.aoc.entity.po.ApprovalRecordPo;
import com.gome.axwl.aoc.service.ApprovalRecordService;
import com.gome.datasource.shard.annotation.ReadDatasource;
import com.gome.datasource.shard.annotation.WriteDatasource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @Auther: yinyuxin@gome.com.cn
 * @Date: 2018/7/16 15:15
 */
@Service("approvalRecordService")
public class ApprovalRecordServiceImpl implements ApprovalRecordService {


    @Autowired
    private ApprovalRecordDao approvalRecordDao;

    @Override
    @WriteDatasource
    public void insert(ApprovalRecordPo approvalRecordPo) {
        approvalRecordDao.insertSelective(approvalRecordPo);
    }


    @Override
    @WriteDatasource
    public void update(ApprovalRecordPo approvalRecordPo) {
        approvalRecordDao.updateByPrimaryKeySelective(approvalRecordPo);
    }


    @Override
    @ReadDatasource
    public ApprovalRecordPo queryById(Integer id) {
        return approvalRecordDao.selectByPrimaryKey(id);
    }

    @Override
    @WriteDatasource
    public void delete(Integer id) {
        approvalRecordDao.deleteByPrimaryKey(id);
    }

    @Override
    @ReadDatasource
    public List<ApprovalRecordPo> queryApprovalHistory(ApprovalRecordPo approvalRecordPo) {
        return approvalRecordDao.queryApprovalHistory(approvalRecordPo);
    }


}
